<?xml version="1.0" encoding="utf-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:com="http://java.sun.com/jsf/composite/componentes"
	xmlns:f="http://java.sun.com/jsf/core">
<ui:composition>
	<h:outputStylesheet library="css" name="mapas.css" />

	<p:confirmDialog header="#{appMessages['foto.remover.titulo']}"
		message="#{appMessages['foto.remover.confirmacao']}" widgetVar="confirmacaoRemoverImagem"
		rendered="#{restrictions.cadastro}">
		<p:commandButton value="#{messages['resposta.sim']}"
			action="#{pontosColetaBean.removerFoto}" update=":formUpload"
			oncomplete="confirmacaoRemoverImagem.hide();" />
		<p:commandButton value="#{messages['resposta.nao']}"
			onclick="confirmacaoRemoverImagem.hide();" />
	</p:confirmDialog>

	<p:dialog id="modalCadastroImagem" widgetVar="modalCadastroImagem"
		modal="true" header="#{appMessages['pontosColeta.cadastrar.adicionarImagem']}"
		dynamic="true" resizable="false"
		draggable="true">

		<h:form id="formUpload" enctype="multipart/form-data">

			<p:galleria value="#{pontosColetaBean.pontoColeta.fotos}" var="image"
				showOverlays="true" filmstripPosition="top" showCaptions="true"
				rendered="#{pontosColetaBean.pontoColeta.fotos.size() > 0}">
				<p:graphicImage value="/image/#{image.idFoto}" />
				<p:galleriaOverlay>
					#{pontosColetaBean.pontoColeta.nome} 
					#{pontosColetaBean.pontoColeta.cidade.estado.sigla} - #{pontosColetaBean.pontoColeta.cidade.nome}
					<div style="float: right; width: auto;">
						<p:commandButton icon="ui-icon-close"
							action="#{pontosColetaBean.carregarImagem(image)}"
							oncomplete="confirmacaoRemoverImagem.show();"
							title="#{appMessages['pontosColeta.remover']}"
							rendered="#{restrictions.admin || restrictions.cadastro}" />
					</div>
				</p:galleriaOverlay>
			</p:galleria>

			<p:fileUpload
				fileUploadListener="#{pontosColetaBean.handleFileUpload}"
				mode="advanced"
				multiple="true"
				update=":formUpload"
				allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
				rendered="#{restrictions.admin || restrictions.cadastro}" />

		</h:form>

	</p:dialog>
</ui:composition>
</html>